package com.leo.boot.mongo.customer;

import org.springframework.data.domain.Sort;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.GeoResults;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.stream.Stream;

public interface CustomerRepository extends CrudRepository<Customer, String> {

	List<Customer> findByLastname(String lastname, Sort sort);

	GeoResults<Customer> findByAddressLocationNear(Point point, Distance distance);

	@Query("{}")
	Stream<Customer> findAllByCustomQueryWithStream();
}
